OPC Studio User's Guide and Reference
Examples for OPC “Classic” (OPC-DA, OPC XML-DA and OPC-A&E)
Client and Subscriber Development > Examples > Examples in the Product and on the Web > .NET and Python Examples > Examples for OPC “Classic” (OPC-DA, OPC XML-DA and OPC-A&E)
In This Topic

Console Examples

 

C#

VB.NET

F#

C++/CLI

PowerShell

Python (.NET)

ConsoleApplication1: The simplest console application. Reads and displays an OPC item value in a console.

 

 

✔ 

 

 

ConsoleLiveMapping: Creates an object structure for a boiler, describes its mapping into OPC Data Access server using attributes, and then performs the live mapping. Boiler data is then read, written and/or subscribed to using plain .NET object access.

 

 

 

 

LogAsStringToSql: Logs OPC Data Access item changes into an SQL database, using a subscription.Values of all data types are stored in a single NVARCHAR column.

 

 

 

 

LogAsUnionToSql: Logs OPC Data Access item changes into an SQL database, using a subscription. Values of all data types are stored in separate columns.

 

 

 

 

LogToSqlEnhanced: Logs OPC Data Access item changes into an SQL database, using a subscription. Item values and qualities are stored in their respective columns. Notifications with the same timestamp are merged into a single row.

 

 

 

 

MultiTargetDocExamples: A large collection of OPC “Classic” and OPC XML-DA console-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed.

 

 

SimpleLogToSql: Logs OPC Data Access item changes into an SQL database, using a subscription.Values of all data types are stored in a single SQL_VARIANT column.

 

 

 

SubscribeFromXml: Loads a list of OPC "Classic" items from an XML file and subscribes to them.

 

 

 

 

WcfClient1: Using a Web service provided by the WcfService1 project (under Web folder), gets and displays a value of an OPC item.

 

 

 

 

XmlEventLogger: Logs OPC Alarms and Events notifications into an XML file.

 

 

 

 

XmlLogger: Logs OPC Data Access item changes into an XML file.

 

 

 

 

 

Web Examples

 

C#

VB.NET

F#

C++/CLI

AutoRefreshWeb: Web application with a screen that refreshes itself periodically with OPC "Classic" values.

 

 

BrowseBranchesWeb: Browses branches in an OPC "Classic" server (ASP.NET Web application).

 

 

BrowseServersWeb: Browses the available OPC "Classic" servers (ASP.NET Web application).

 

 

DataGridWebApplication: Demonstrates how easily can WebControls.GridView be populated with data read from OPC Data Access server.

 

 

WcfService1: A simple Web service using WCF technology. Provides a GetData method to read a value of an OPC item. Use WcfClient1 project (under Console folder) to test this Web service.

 

 

WebApplication1: The simplest ASP.NET Web application for OPC “Classic”. Reads and displays an OPC item value.

 

 

WebService1: A simple Web service using ASMX technology. Provides "Hello World" method to read a value of an OPC "Classic" item.

 

 

 

Windows Forms Examples

 

C#

VB.NET

F#

C++/CLI

Python (.NET)

EasyOpcNetDemo: This is a source of the Demo application for OPC “Classic” that ships with the QuickOPC.NET product. The application shows most product functions, including the browsing forms, OPC property access, and event-based subscriptions.

 

 

 

EasyOpcNetDemoXml: This is a source of the Demo application for OPC “Classic” (OPC XML-enabled) that ships with the QuickOPC.NET product. The application shows most product functions, including the browsing forms, OPC property access, and event-based subscriptions. The defaults are pre-filled for OPC XML-DA demo server, but the application is written in such a way that it can handle COM servers as well.

 

 

 

 

FormsDocExamples: A collection of OPC “Classic” and OPC XML-DA Windows Forms-based examples that illustrate the use of individual objects in the product, and their members. These are the same examples that appear in reference and conceptual documentation, with an extra control routine that allows the use to choose an example to be performed.

 

 

 

HmiScreen: Windows Forms application that shows how to implement an HMI screen by storing OPC "Classic" Item IDs in the Tag property of screen controls, and animate the controls by subscribing to all items at once. Also shows a possibility how to write to an OPC item from the screen.

 

 

 

ListView1: Shows how (Windows Forms) ListView items can be populated with OPC data, either using explicit Read, or with a subscription.

 

 

 

 

LiveBindingDemo: Shows live binding of OPC Data Access information (from simulation OPC server) to standard Windows Forms controls (Microsoft). All binding to OPC data is achieved with no manual coding, only by configuring the components in Visual Studio.

               
Live Binding Demo

Live Binding Demo

 

 

 

LiveBindingDemo2: Shows advanced live binding features in OPC "Classic". Among others, it demonstrates:

·         Binding kinds: binding to local vs. UTC timestamp.

·         Conversions: Use of LinearConverter, even bi-directionally.

·         Animations: Moving a control around the form, depending on an OPC tag value.

·         Cumulative: Adding incoming values to ListBox or ListView.

 

 

 

 

OvenControl: Monitors sensors in an industrial oven, indicates level alarms by changing colors, allows the user to change a setpoint, and logs the values into a CSV file.

 

 

 

QualityStrings: Shows how numerical OPC quality codes are converted to displayable strings (Windows Forms application).

 

 

 

SubscribeToMany: Demonstrates and measures performance with large number of subscribed OPC "Classic" (OPC-DA) items.

 

 

 

ValueToMessageBox: Very simple Windows Forms application that reads and displays an OPC "Classic" item value in a message box after the user clicks on a button.

 

 

 

WindowsFormsApplication1: The simplest Windows Forms application. Reads and displays an OPC "Classic" (OPC-DA) item value on a form. This is what you get if you follow the steps described in Quick Start for QuickOPC.NET.

 

 

 

 

Windows Service Examples

 

C#

VB.NET

F#

C++/CLI

WindowsService1: A Windows Service that subscribes to items from the simulation server, and logs their changes into a file.

 

 

 

WPF Examples

 

C#

VB.NET

F#

C++/CLI

OpcDAQualityDecoder: A simple WPF application that decodes the cryptic OPC quality numbers into the separate fields and their symbolic representation.

 

 

 

WpfApplication1: The simplest WPF application for OPC “Classic”. Reads and displays an OPC item value.

 

 

 

 

See Also

Knowledge Base